#include <iostream>
#include <unordered_map>

using namespace std;

class Solution {
public:
    string getHint(string secret, string guess) {
        unordered_map<char, int> map;
        for (char item : secret) {
            map[item]++;
        }
        int A = 0;
        int B = 0;
        for (int i = 0; i < secret.size(); i++) {
            if (secret[i] == guess[i]) {
                A++;
                map[guess[i]]--;
            }
        }
        for (int i = 0; i < secret.size(); i++) {
            if (secret[i] != guess[i] && map[guess[i]] > 0) {
                B++;
                map[guess[i]]--;
            }
        }
        return to_string(A) + "A" + to_string(B) + "B";
    }
};

